/*
 * @Author: huangyingli
 * @Date: 2023-02-08 10:06:18
 * @LastEditors: huangyingli
 * @LastEditTime: 2023-02-25 02:42:19
 * @Description:
 */
import { Base64 } from 'js-base64';
/**
 * 从数组中删除指定元素
 * @param {Array} arr
 * @param {*} ele
 */
export function removeBy(arr, ele) {
  if (!Array.isArray(arr)) return arr;
  let idx = arr.findIndex((e) => e === ele);
  if (idx !== -1) {
    arr.splice(idx, 1);
  }
  return arr;
}

/**
 * 判断是否是一个空对象,空数组
 * @param {Arrar|Object} obj
 */
export function isEmpty(obj) {
  let keys = Object.keys(obj);
  if (keys.length === 0) return true;
  else return false;
}

export function unique(...args) {
  let base64s = args.map((arg) => Base64.encode(arg.toString()).toString());
  return base64s.join('');
}
